home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / lib / partman / finish.d / 20mount_partitions < prev    next >
Text File  |  2009-10-28  |  2KB  |  85 lines

  1. #!/bin/sh
  2.  
  3. . /lib/partman/lib/base.sh
  4.  
  5. fstab=$(
  6.     for i in /lib/partman/fstab.d/*; do
  7.         [ -x "$i" ] || continue
  8.         $i
  9.     done |
  10.     while read fs mp type options dump pass; do
  11.         echo $mp $fs $type $options $dump $pass
  12.     done |
  13.     sort |
  14.     while read mp fs type options dump pass; do
  15.         newoptions=
  16.         while [ "$options" ]; do
  17.             case $options in
  18.                 (ro,*)
  19.                 options="${options#ro,}"
  20.                 ;;
  21.                 (ro)
  22.                 options=
  23.                 ;;
  24.                 (*,*)
  25.                 newoptions="${newoptions:+$newoptions,}${options%%,*}"
  26.                 options="${options#*,}"
  27.                 ;;
  28.                 (*)
  29.                 newoptions="${newoptions:+$newoptions,}$options"
  30.                 options=
  31.                 ;;
  32.             esac
  33.         done
  34.         if [ -z "$newoptions" ]; then
  35.             newoptions=defaults
  36.         fi
  37.         echo $fs $mp $type $newoptions $dump $pass
  38.     done
  39. )
  40.  
  41. IFS="$NL"
  42. for f in $fstab; do
  43.     restore_ifs
  44.     set -- $f
  45.     case "$2" in
  46.         /media/*)
  47.         mkdir -p "/target$2"
  48.         continue
  49.         ;;
  50.         /*)
  51.         mkdir -p "/target$2"
  52.         ;;
  53.     esac
  54.     for m in /lib/partman/mount.d/*; do
  55.         [ -x "$m" ] || continue
  56.  
  57.         # partman-doc specifies that mount.d scripts output the command
  58.         # needed to unmount the partition; currently this is unused
  59.         unmount_cmd=$($m "$f")
  60.         if [ "$?" = 0 ]; then
  61.             case $2 in
  62.                 /)
  63.                 # Create these before /var is mounted,
  64.                 # so that they can be mounted as tmpfses
  65.                 mkdir -p /target/var/lock
  66.                 mkdir -p /target/var/run
  67.                 ;;
  68.             esac
  69.             continue 2
  70.         fi
  71.     done
  72.  
  73.     db_subst partman-target/mount_failed DEVICE $(humandev $1)
  74.     db_subst partman-target/mount_failed MOUNTPOINT $2
  75.     db_subst partman-target/mount_failed TYPE $3
  76.     db_input critical partman-target/mount_failed || true
  77.     db_go || exit 1
  78.     db_get partman-target/mount_failed
  79.     if [ "$RET" = true ]; then
  80.         exit 1
  81.     else
  82.         exit 2
  83.     fi
  84. done
  85.